﻿create PROCEDURE Sync.SP_UserMessages_SelectChanges
@LastRowVersion rowversion,
@FilterdColumn UNIQUEIDENTIFIER
AS 
BEGIN 
	SELECT 
        t.[UserMessageID],
		g.[CreationDate],g.[FromUserID],g.[ToUserID],g.[Subject],g.[Message],
		t.IsDeleted,
		t.LastUpdatedDate
	FROM [dbo].[UserMessages] g RIGHT JOIN Sync.UserMessages_Tracking t  
    ON t.UserMessageID = g.UserMessageID 
	WHERE @LastRowVersion IS NULL OR t.Version > @LastRowVersion
    END





